package com.vincent.sms;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.provider.Telephony;

/**
 * projectName:          Sms
 * packageName:          com.vincent.sms
 * className:            DefaultSmsHelper
 * author:               Luoxiang
 * time:                 2025/6/29	10:43
 * desc:                 TODO
 * <p>
 * svnVersion:
 * upDateAuthor:         a
 * upDate:               2025/6/29
 * upDateDesc:           TODO
 */
public class DefaultSmsHelper {
    public static boolean isDefaultSmsApp(Context context) {
        return context.getPackageName().equals(
                Telephony.Sms.getDefaultSmsPackage(context));
    }

    public static void requestToBeDefaultSmsApp(Activity activity, int requestCode) {
        Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
        intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME,
                activity.getPackageName());
        activity.startActivityForResult(intent, requestCode);
    }
}
